<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); ?>

<div class="middle">
    
    <div class="pad10">
    
    	<table cellpadding="0" cellspacing="0" border="0">
			<tr>
				<td class="ver-middle">
					<input type="button" value="Set all channel" style="padding: 2px 15px; cursor: pointer;" onclick="set_all_channel();" />
				</td>
				<td class="ver-middle padleft5">
					<img id="loading" src="/images/ajaxLoading.gif" alt="loading..." style="display: none;" />
				</td>
			</tr>
		</table>
    	
    	
    	<br /><br />
    	<p class="padbottom10">
			<b>Set all channel for banner by bannerid: </b> (Nhập bannerid, phân biệt  = ',')
		</p>
    	<table cellpadding="0" cellspacing="0" border="0">
			<tr>
				<td class="ver-middle">
					<input type="text" name="txtSet" id="txtSet" style="width: 500px; padding: 5px 5px;" />
				</td>
				<td class="ver-middle">
					<input type="button" value="&nbsp;&nbsp;Set&nbsp;&nbsp;" style="padding: 2px 15px; cursor: pointer;" onclick="set_tmp_all_channel();" />
				</td>
				<td class="ver-middle padleft5">
					<img id="loading2" src="/images/ajaxLoading.gif" alt="loading..." style="display: none;"/>
				</td>
			</tr>
		</table>
    </div>
</div>

<script type="text/javascript">
	function set_all_channel()
	{
		if(confirm('Bạn có chắc chắn thực hiện thao tác này?'))
		{
			var _onComplete = function(data)
			{
				data = $.trim(data);
				if(data == 'ok')
				{
					alert('Update Ok!');
				}
				else
				{
					alert('Update error!');
				}
				$('#loading').hide();
			};
			
			$('#loading').show();
			getAjax('/admin/settings/set_all_channel', 'action=1','', 'POST', '', false,_onComplete);
		}
	}
	function set_tmp_all_channel()
	{
		var id = $.trim($('#txtSet').val());
		if(id == '')
		{
			alert('Bạn hãy nhập banner id');
			$('#txtSet').focus();
			return false;
		}
		else
		{
			var _onComplete = function(data)
			{
				data = $.trim(data);
				if(data == 'ok')
				{
					alert('Update Ok!');
				}
				else
				{
					alert('Update error!');
				}
				$('#loading2').hide();
			};
			
			$('#loading2').show();
			getAjax('/admin/settings/set_all_channel', 'action=2&id=' + id, '', 'POST', '', false,_onComplete);
		}
	}
</script>